const { generate19DigitId } = require('../utils/idUtils')
const db=require('../../MySql')

class sys_user_role{
    constructor(id,user_id,role_id){
        this.id=id
        this.user_id=user_id
        this.role_id=role_id
    }


    static async addUserRole(user_id,role_id){
        const id=generate19DigitId()
        const sql=`insert into sys_user_role(id,user_id,role_id) values(?,?,?)`
        await db.query(sql,[id,user_id,role_id])
    }


    static async deleteUserRoleByUserID(userId){
        const sql=`delete from sys_user_role where user_id =?`
        await db.query(sql,[userId])
    }

}

module.exports=sys_user_role